/**
 * Copyright 2020 Tianshu AI Platform. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================
 */
package org.dubhe.admin.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.dubhe.admin.domain.entity.*;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @description 权限组mapper接口
 * @date 2021-05-14
 */

@Repository
public interface AuthCodeMapper extends BaseMapper<Auth> {
    /**
     * 通过权限组id获取权限
     *
     * @param authId 权限组id
     * @return List<Permission> 权限列表
     */
    @Select("select * from permission where id in (select permission_id from auth_permission where auth_id=#{authId}) and deleted=0 order by id")
    List<Permission> getPermissionByAuthId(Long authId);
}
